﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WebStore.Domain.Entities.Model
{
    public class User
    {
        public int Id { get; set; }
        
        public string Email { get; set; }

        public string Password { get; set; }

        public string FirstName { get; set; }

        public string SecondName { get; set; }

        public string LastName { get; set; }

        public string AddressLine { get; set; }

        public string City { get; set; }

        public string PostalCode { get; set; }

        public virtual ICollection<Order> Orders { get; set; }

        public virtual ICollection<UserRole> UserRoles { get; set; } 
    }

    public class UserConfiguration:EntityTypeConfiguration<User>
    {
        public UserConfiguration()
        {
            HasMany(x => x.Orders).WithRequired(x => x.User);
            HasMany(x => x.UserRoles).WithRequired(x => x.User);
        }
    }
}
